<template>
  <div class="contanier border_top">
    <div class="nav flex align-center">
      <div
        v-for="(item, index) in navList"
        :key="index"
        class="flex align-center"
        :class="nav_act == index ? 'active' : ''"
        v-on:mousemove="navhover(index)"
        @mouseleave="mouseLeave"
        @click="navclcik(index, item.path)"
      >{{ item.text }}</div>
      <span class="morex">[查看更多]</span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      navList: [
        {
          path: "/",
          text: "煤炭交易价格",
        },
      ],
      nav_act: 0,
      hea_act: 0,
    };
  },
  mounted() {},
  methods: {
    mouseLeave() {
      this.nav_act = this.hea_act;
    },
    navclcik(index, path) {
      this.nav_act = index;
      this.hea_act = index;
      this.$router.push({
        //核心语句
        path: path,
      });
    },
    navhover(data) {
      this.nav_act = data;
    },
  },
};
</script>

<style lang="stylus" scoped>
.contanier {
  width: 588px;
  height: 304px;
  background: #FFFFFF;
  box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
}

.nav {
  position: relative;
}

.nav>div {
  height: 40px;
  font-size: 16px;
  font-weight: 400;
  color: #BF242A;
  padding: 0 20px;
  cursor: pointer;
}

.nav>div.active {
  color: #ffffff;
  border-color: #ffffff;
  background: #EB424C;
  // border-image: -webkit-linear-gradient(to right, #00036B, #409EFF) 30 30;
  // border-image: -moz-linear-gradient(to right, #00036B, #409EFF) 30 30;
  // border-image: linear-gradient(to right, #00036B, #409EFF) 30 30;
}

.morex {
  display: inline-block;
  font-size: 14px;
  color: #666666;
  position: absolute;
  right: 12px;
  cursor: pointer;
}
</style>